/**
 * 登录模块
 */
var HttpHelper = require('HttpHelper')
var Api = require('Api')

class LoginManager {

    /**
     * 账号注册
     *
     * @param  {[type]} data [description]
     * @param  {Function} cb   [description]
     * @return {[type]}      [description]
     */
    static register (data, cb) {
        HttpHelper.post(Api.register, data, (res) => {
            cb(res)
        })
    }

    /**
     * 账号登录
     *
     * @param  {[type]}   data [description]
     * @param  {Function} cb   [description]
     * @return {[type]}        [description]
     */
    static login (data, cb) {
        HttpHelper.post(Api.login, data, (res) => {
            cb(res)
        })
    }

    /**
     * 获取更新内容
     *
     * @param  {Function} cb [description]
     * @return {[type]}      [description]
     */
    static update (cb) {
        HttpHelper.post(Api.update, [], (res) => {
            cb(res)
        })
    }
}

LoginManager.userinfo = null

module.exports = LoginManager
